#include "Domain8583.h"

//中石油
FieldInfo petroInfo ={5, 65, {
                     //域号 格式 对齐方式 最大长度
                            {0,  4, 2, 4,  '0'},  //N-4 信息头域
                            {1,  1, 1, 8,  ' '},  //B-64 位图域
                            {2,  5, 2, 20, '0'},  //N..10 LLVAR BCD 主账号
                            {3,  4, 2, 6,  '0'},  //N-6 BCD 处理码
                            {4,  4, 2, 12, '0'},  //N-12 BCD 交易金额
                            {5,  4, 2, 12, '0'},  //定长6字节BCD
                            {6,  4, 2, 12, '0'},  //银行用，小费
                            {7,  4, 2, 14, '0'},  //N-14 YYYYMMDDhhmmss7字节定长BCD
                            {8,  4, 2, 14, '0'},  //N-14 YYYYMMDDhhmmss7字节定长BCD
                            {9,  5, 1, 20, '0'},  //不用
                            {10, 4, 2, 12, '0'},  //6字节定长BCD
                            {11, 4, 2, 12, '0'},  //N-12 6字节定长BCD 流水号
                            {12, 1, 1, 12, '0'},  //定长12字节ASC
                            {13, 4, 2, 4,  '0'},  //不用
                            {14, 4, 2, 4,  '0'},  //不用
                            {15, 1, 2, 6,  '0'},  //不用
                            {16, 1, 1, 4,  '0'},  //不用
                            {17, 1, 1, 4,  '0'},  //不用
                            {18, 3, 2, 9999,  '0'},  //不用
                            {19, 2, 2, 2,  '0'},  //ANS..2 ASCII 分期期数
                            {20, 5, 1, 99, '0'},  //最长99变长BCD
                            {21, 1, 1, 1,  '0'},  //不用
                            {22, 1, 1, 1,  '0'},  //1字节定长ASC
                            {23, 1, 2, 2,  '0'},  //N-3 BCD IC卡序列号
                            {24, 5, 2, 20,  '0'},  //N-3 BCD 快钱系统默认使用009
                            {25, 3, 2, 999,  '0'},  //N-2 BCD 服务点条件码 02:ATM;10:银行终端;14:POS;20:电话银行
                            {26, 1, 1, 2,  '0'},  //不用
                            {27, 1, 2, 2,  '0'},  //不用
                            {28, 1, 1, 1,  '0'},  //不用
                            {29, 1, 1, 1,   '0'},  //不用
                            {30, 1, 1, 1,   '0'},  //不用
                            {31, 1, 1, 1,   '0'},  //不用
                            {32, 1, 1, 11,  '0'},  //不用
                            {33, 1, 1, 11,  '0'},  //不用
                            {34, 2, 2, 28,  '0'},  //N..28 ASCII 扩展主账号
                            {35, 2, 2, 37,  '0'},  //Z..37 BCD 二磁道数据5
                            {36, 3, 2, 104, '0'},  //Z..104 BCD 三磁道数据6
                            {37, 1, 1, 24,  '0'},  //AN-24 ASCII 参考号
                            {38, 1, 1, 6,   '0'},  //AN-6 ASCII 授权码
                            {39, 1, 1, 5,   '0'},  //5字节定长ASC 交易返回结果
                            {40, 3, 1, 999, '0'},  //变长ASC...9999
                            {41, 1, 1, 12,  ' '},  //12字节定长ASC
                            {42, 1, 1, 15,  ' '},  //ANS-15 唯一地标识出卡片接受方（商户或者网点）的编号
                            {43, 1, 1, 12,  ' '},  //不用
                            {44, 1, 1, 14, '0'},
                            {45, 1, 2, 14,   '0'},
                            {46, 1, 2, 15, '0'},
                            {47, 3, 1, 999, '0'},  //不用
                            {48, 5, 2, 99,  '0'},  //最长99 变长BCD LLLVAR 附加数据
                            {49, 4, 2, 3,   '0'},  //AN-3 BCD 货币代码
                            {50, 1, 1, 3,   '0'},  //不用
                            {51, 1, 1, 3,   '0'},  //不用
                            {52, 1, 1, 8,   '0'},  //B-64 与持卡人PIN有关的数据
                            {53, 1, 1, 15,  '0'},  //ANS-15 结算商户号
                            {54, 4, 2, 12,  '0'},  //定长6字节BCD
                            {55, 4, 2, 12,  '0'},  //定长6字节BCD
                            {56, 6, 2, 255, '0'},  //ANS..255 BCD
                            {57, 6, 2, 255, '0'},  //ANS..255 BCD
                            {58, 1, 1, 1,   ' '},  //不用
                            {59, 3, 2, 28,  '0'},  //ANS..28 ASCII 汇率信息
                            {60, 1, 1, 20,  '0'},  //定长20字节ASC
                            {61, 2, 1, 99,  '0'},  //最长99变长ASCII 自定义域
                            {62, 3, 1, 9999, '0'},  //最长9999变长ASCII 自定义域
                            {63, 3, 1, 9999, '0'},  //ANS..30 ASCII 自定义域
                            {64, 4, 1, 16,   '0'}}  //MAC
}; //配4信息64个域

//工行数据格式定义
FieldInfo icbcInfo ={5, 65, {
                     //域号 格式 对齐方式 最大长度
                            {0,  4, 2, 4,  '0'},  //N-4 信息头域
                            {1,  1, 1, 8,  ' '},  //B-64 位图域
                            {2,  5, 1, 19, '0'},  //N..10 LLVAR BCD 主账号
                            {3,  4, 2, 6,  '0'},  //N-6 BCD 处理码
                            {4,  4, 2, 12, '0'},  //N-12 BCD 交易金额
                            {5,  4, 2, 12, '0'},  //定长6字节BCD
                            {6,  4, 2, 12, '0'},  //银行用，小费
                            {7,  4, 2, 10, '0'},  //N-10 MMDDhhmmss终端时间
                            {8,  1, 2, 1, '0'},  //A-1 新旧包标志
                            {9,  4, 2, 8, '0'},  //清算兑换率
                            {10, 4, 2, 12, '0'},  //6字节定长BCD
                            {11, 4, 2, 6, '0'},  //N-6 系统跟踪号
                            {12, 4, 1, 6, '0'},  //HHMMSS交易时间
                            {13, 4, 2, 8,  '0'},  //YYYYMMDD交易日期
                            {14, 4, 2, 4,  '0'},  //有效期
                            {15, 4, 2, 8,  '0'},  //yyyymmdd原交易日期
                            {16, 1, 1, 1,  '0'},  //积分标志
                            {17, 1, 1, 4,  '0'},  //不用
                            {18, 4, 1, 5,  '0'},  //中奖顺序号
                            {19, 2, 2, 2,  '0'},  //ANS..2 ASCII 分期期数
                            {20, 5, 1, 99, '0'},  //最长99变长BCD
                            {21, 1, 1, 7,  '0'},  //版本号
                            {22, 4, 2, 3,  '0'},  //POS进入方式
                            {23, 4, 2, 3,  '0'},  //N-3卡序列号
                            {24, 1, 2, 4,  '0'},  //单位个人标志
                            {25, 3, 2, 999,  '0'},  //N-2 BCD 服务点条件码 02:ATM;10:银行终端;14:POS;20:电话银行
                            {26, 1, 1, 2,  '0'},  //中油标志
                            {27, 4, 2, 1,  '0'},  //授权码长度
                            {28, 1, 1, 1,  '0'},  //3DES/外卡标志
                            {29, 1, 1, 1,   '0'},  //不用
                            {30, 1, 1, 8,   '0'},  //交换中心终端号
                            {31, 1, 1, 6,   '0'},  //交换中心交易流水号
                            {32, 5, 1, 11,  '0'},  //金卡受理行标志
                            {33, 1, 1, 6,  '0'},  //受理行号
                            {34, 2, 2, 28,  '0'},  //N..28 ASCII 扩展主账号
                            {35, 3, 2, 37,  '0'},  //Z..37 BCD 二磁道数据5
                            {36, 3, 1, 104, '0'},  //Z..104 BCD 三磁道数据6
                            {37, 1, 1, 23,  '0'},  //N-23 ASCII 检索参考号
                            {38, 1, 1, 6,   '0'},  //AN-6 ASCII 授权号
                            {39, 1, 1, 2,   '0'},  //2字节定长ASC 响应码
                            {40, 1, 1, 3, '0'},  //原交易终端号后三位
                            {41, 1, 1, 15,  ' '},  //终端标识
                            {42, 1, 1, 12,  ' '},  //商场编号
                            {43, 1, 1, 40,  ' '},  //商户名称
                            {44, 2, 1, 13, '0'},  //附加响应代码
                            {45, 1, 2, 14,   '0'},  //不用
                            {46, 3, 2, 255, '0'},  //ANS..255 ASCII TLV处理域
                            {47, 3, 1, 999, '0'},  //不用
                            {48, 5, 2, 99,  '0'},  //最长99 变长BCD LLLVAR 附加数据
                            {49, 1, 1, 3,   '0'},  //交易货币代码
                            {50, 1, 1, 3,   '0'},  //清算货币代码
                            {51, 1, 1, 3,   '0'},  //不用
                            {52, 4, 1, 16,   '0'},  //B-64 个人PIN
                            {53, 1, 1, 15,  '0'},  //ANS-15 结算商户号
                            {54, 6, 2, 120,  '0'},  //TOTAL
                            {55, 3, 2, 255,  '0'},  //IC卡数据
                            {56, 3, 2, 999, '0'},  //中油油品信息
                            {57, 3, 1, 999, '0'},  //ANS..255 BCD
                            {58, 3, 1, 999,   ' '},  //错误信息
                            {59, 3, 2, 999,  '0'},  //相关信息
                            {60, 1, 1, 8,  '0'},  //B-64 MAC_KEY
                            {61, 1, 1, 8,  '0'},  //B-64 PIN_KEY
                            {62, 4, 1, 150, '0'},  //3DES密钥
                            {63, 1, 1, 12, '0'},  //AKEY顺序号
                            {64, 4, 1, 16,   '0'}}  //MAC
}; //配4信息64个域

//银联数据格式定义
FieldInfo unionInfo ={11, 65, {
                     //域号 格式 对齐方式 最大长度
                            {0,  4, 2, 4,  '0'},  //N-4 信息头域
                            {1,  1, 1, 8,  ' '},  //B-64 位图域
                            {2,  5, 1, 19, '0'},  //N..10 LLVAR BCD 主账号
                            {3,  4, 2, 6,  '0'},  //N-6 BCD 处理码
                            {4,  4, 2, 12, '0'},  //N-12 BCD 交易金额
                            {5,  4, 2, 12, '0'},  //定长6字节BCD
                            {6,  4, 2, 12, '0'},  //银行用，小费
                            {7,  4, 2, 10, '0'},  //N-10 MMDDhhmmss终端时间
                            {8,  1, 2, 1, '0'},  //A-1 新旧包标志
                            {9,  4, 2, 8, '0'},  //清算兑换率
                            {10, 4, 2, 12, '0'},  //6字节定长BCD
                            {11, 4, 2, 6, '0'},  //N-6 系统跟踪号
                            {12, 4, 1, 6, '0'},  //HHMMSS交易时间
                            {13, 4, 2, 4,  '0'},  //YYYYMMDD交易日期
                            {14, 4, 2, 4,  '0'},  //有效期
                            {15, 4, 2, 4,  '0'},  //yyyymmdd原交易日期
                            {16, 1, 1, 1,  '0'},  //积分标志
                            {17, 1, 1, 4,  '0'},  //不用
                            {18, 4, 1, 5,  '0'},  //中奖顺序号
                            {19, 2, 2, 2,  '0'},  //ANS..2 ASCII 分期期数
                            {20, 5, 1, 99, '0'},  //最长99变长BCD
                            {21, 1, 1, 7,  '0'},  //版本号
                            {22, 4, 2, 3,  '0'},  //POS进入方式
                            {23, 4, 2, 3,  '0'},  //N-3卡序列号
                            {24, 1, 2, 4,  '0'},  //单位个人标志
                            {25, 4, 2, 2,  '0'},  //N-2 BCD 服务点条件码 02:ATM;10:银行终端;14:POS;20:电话银行
                            {26, 4, 1, 2,  '0'},  //中油标志
                            {27, 4, 2, 1,  '0'},  //授权码长度
                            {28, 1, 1, 1,  '0'},  //3DES/外卡标志
                            {29, 1, 1, 1,   '0'},  //不用
                            {30, 1, 1, 8,   '0'},  //交换中心终端号
                            {31, 1, 1, 6,   '0'},  //交换中心交易流水号
                            {32, 5, 1, 11,  '0'},  //金卡受理行标志
                            {33, 1, 1, 6,  '0'},  //受理行号
                            {34, 2, 2, 28,  '0'},  //N..28 ASCII 扩展主账号
                            {35, 5, 2, 37,  '0'},  //Z..37 BCD 二磁道数据5
                            {36, 6, 1, 104, '0'},  //Z..104 BCD 三磁道数据6
                            {37, 1, 1, 12,  '0'},  //N-23 ASCII 检索参考号
                            {38, 1, 1, 6,   '0'},  //AN-6 ASCII 授权号
                            {39, 1, 1, 2,   '0'},  //2字节定长ASC 响应码
                            {40, 1, 1, 3, '0'},  //原交易终端号后三位
                            {41, 1, 1, 8,  ' '},  //终端标识
                            {42, 1, 1, 15,  ' '},  //商场编号
                            {43, 1, 1, 40,  ' '},  //商户名称
                            {44, 2, 1, 25, '0'},  //附加响应代码
                            {45, 1, 2, 14,   '0'},  //不用
                            {46, 3, 2, 255, '0'},  //ANS..255 ASCII TLV处理域
                            {47, 3, 1, 999, '0'},  //不用
                            {48, 6, 2, 322,  '0'},  //最长99 变长BCD LLLVAR 附加数据
                            {49, 1, 1, 3,   '0'},  //交易货币代码
                            {50, 1, 1, 3,   '0'},  //清算货币代码
                            {51, 1, 1, 3,   '0'},  //不用
                            {52, 4, 1, 16,   '0'},  //B-64 个人PIN
                            {53, 4, 1, 16,  '0'},  //ANS-15 结算商户号
                            {54, 2, 2, 20,  '0'},  //TOTAL
                            {55, 3, 2, 255,  '0'},  //IC卡数据
                            {56, 3, 2, 999, '0'},  //中油油品信息
                            {57, 3, 1, 999, '0'},  //ANS..255 BCD
                            {58, 3, 1, 100,   ' '},  //错误信息
                            {59, 3, 2, 999,  '0'},  //相关信息
                            {60, 6, 1, 17,  '0'},  //B-64 MAC_KEY
                            {61, 6, 1, 29,  '0'},  //B-64 PIN_KEY
                            {62, 3, 1, 512, '0'},  //3DES密钥
                            {63, 3, 1, 163, '0'},  //AKEY顺序号
                            {64, 4, 1, 16,   '0'}}  //MAC
}; //配4信息64个域
